<template>
  <div id="app">
    <head-top :glucosePressureList="glucosePressureList" @deviceChange="onChange"></head-top>
    <current-status :currentGlucosePressure="currentGlucosePressure"></current-status>
    <detail-data/>
  </div>
</template>

<script>
import CurrentStatus from './components/CurrentStatus.vue'
import DetailData from './components/DetailData.vue'
import HeadTop from './components/HeadTop.vue'
export default {
  name: 'App',
  data(){
    return{
      
      glucosePressureList:[],
      currentGlucosePressure:{},
      
    }
  },
  components: {
    HeadTop,
    CurrentStatus,
    DetailData
  },
  created(){
    this.getGlucosePressure()
  },
  mounted(){
  },
  methods:{
    
    onChange(index){
      this.currentGlucosePressure=this.glucosePressureList[index]
    },
    getGlucosePressure(){
      this.axios.get("/glucosePresure/list").then((res)=>{
        this.glucosePressureList=res.data
        console.log('a',res.data)
        this.currentGlucosePressure=res.data[0]
        this.$bus.$emit('currentGlucosePressure',res.data[0])
      })
    }
  }
}
</script>

<style>
body{
  margin: 0;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
</style>
